Return to doc.sitecore.com

Valid for Sitecore 5.3
  Occasional Media Cache Cleanup Issue

In some circumstances, Sitecore's default media cache cleanup agent can become corrupted, resulting in a significant CMS performance decrease and significant increase in disk usage. 

If you experience these symptoms, please use the following instructions to fix the problem: 

  1. Restart IIS and remove all files and folders from the /App_Data/MediaCache folder.
  2. Download the assembly available on this page and place it in the "\bin" folder of your Sitecore installation.
  3. Add the following agent to the <scheduling /> section of your web.config file:
     
    <!-- Agent to clear media cache. -->
    <agent type="Sitecore.Support.MediaCacheCleaner, mediacachecleaner" method="Run" interval="04:00:00">
    <param desc="database">web</param>
           <param desc="days before execution">90</param>
    </agent>
      
    The “interval” parameter, which is set to 4 hours in this example, can be adjusted according to your needs. The "database" parameter should correspond to the name of the existing content delivery database in your Sitecore environment. This is the “web” database by default. The “days before execution” parameter defines the time period for the media cache files before they are removed from the file system.
     
  4. Comment out or delete the “remove” definition shown in bold below for the default CleanupAgent so that it does not clear the media cache:
     
    <agent type="Sitecore.Tasks.CleanupAgent" method="Run" interval="06:00:00">
    <files hint="raw:AddCommand">
    <remove folder="$(dataFolder)/audit" pattern="audit.*.txt" maxCount="5" minAge="01:00:00"/>
    <remove folder="$(dataFolder)/logs" pattern="log.*.txt" maxCount="5" minAge="01:00:00"/>
    <remove folder="$(dataFolder)/viewstate" pattern="*.txt" maxAge="01:00:00" recursive="true"/>
    <!--<remove folder="/App_Data/MediaCache" pattern="*.*" maxAge="90.00:00:00" recursive="true"/>-->
    </files>
    </agent>

Download the MediaCacheCleaner assembly (.zip archive, 3Kb)